package demo2;

import demo1.JDBCUtil;
import org.apache.commons.dbutils.QueryRunner;
import org.junit.Test;

import java.io.IOException;
import java.sql.Connection;
import java.sql.SQLException;

public class QueryTest {

    @Test
    public void testConnection() throws SQLException, IOException {
        Connection connection = JDBCUtils.getConnection();
        QueryRunner runner = new QueryRunner();
        int rows = runner.update(connection, "update user_table set balance = ? where user = ?", 8800, "bb");
        if (rows > 0) {
            System.out.println("修改成功!");
        }
        JDBCUtil.closeConnection(connection,null);

    }
}
